﻿using DevExpress.Skins;
using DevExpress.UserSkins;
using Lamex.Base;
//using Lamex.Bridge;
using Lamex.Common;
using Lamex.Main;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading;
using System.Windows.Forms;

namespace Lamex
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            #region 自动更新
            //try
            //{
            //    UpdateForm update = new UpdateForm();
            //    if (update._Update())
            //    {
                   
            //    }
            //}
            //catch (Exception ex)
            //{
                
            //    MessageBox.Show(ex.Message);
            //}

           


            #endregion
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            
            BonusSkins.Register();//Dev皮肤
            //OfficeSkins.Register();////样式的皮肤
            SkinManager.EnableFormSkins();//启用窗体支持换肤特性
            SystemConfig.ReadSettings();
 

            //资源的根名称

            Type type = MethodBase.GetCurrentMethod().DeclaringType;

            string _namespace = type.Namespace;

            //获取当前主程序集

            Assembly currentAssembly = Assembly.GetExecutingAssembly();

            //资源的根名称

            string resourceRootName = "Lamex.Main.ResourceEng";

            ResourceManager rm = new ResourceManager(resourceRootName, currentAssembly);
            string name = rm.GetString("txtEditDESCRIPTION_NUMBER");
           
            if (Login._Login())
            {
               

                if (Loginer.CurrentUser.ChangeLanguage == 0)
                    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hans");
                else
                    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-Us");
                Program.MainForm.Show();
                Application.Run();
                
                //Form1 frm = new Form1();
                //frm.ShowDialog();
            }
            else
                Application.Exit();

        }
        private static frmMainForm _mainForm = null;
        /// <summary>
        /// MDI主窗体
        /// </summary>        
        public static frmMainForm MainForm { get { return _mainForm; } set { _mainForm = value; } }
   
    }

}
